import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { Logger } from '@nestjs/common';
import { NestExpressApplication } from '@nestjs/platform-express';
import { join } from 'path';

async function bootstrap() {
  // const portList: Array<number> = [3001, 3002, 3003, 3004, 3005];
  const portList: Array<number> = [3001];
  for (let i = 0; i < portList.length; i++) {
    let port: number = portList[i];
    const app = await NestFactory.create<NestExpressApplication>(AppModule);
    let nowPath: string = join(__dirname, '../public' + port);
    Logger.log("nowPath===" + nowPath)
    app.useStaticAssets(nowPath, {
      prefix: '/static/', // 虚拟名称 http://localhost:3010/static/...png
    });
    await app.listen(port);
  }
    
  console.log("haonestjs start suc===")
}
bootstrap();
